﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo9
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine( );
            Console.WriteLine("---------------------------------------欢迎进入游戏世界--------------------------------");
            Console.WriteLine();
            Console.WriteLine("***************************************************************************************");
            Console.WriteLine("*************************************猜拳，开始****************************************");
            Console.WriteLine("***************************************************************************************");
            Console.WriteLine();

            Console.WriteLine("出拳规则: 1,剪刀 2，石头 3，布");
            Console.WriteLine();

            Text();

            Console.WriteLine();
            Console.WriteLine("要继续吗? （Y / N）");
            char num5 = char.Parse(Console.ReadLine());
            if (num5 == 'Y')
            {
                Text();
            }
            else
            {
                Console.WriteLine("游戏已退出!!!!!");
            }

        }
        static void Text()
        {

            Console.WriteLine("请选择对方的角色：<1:刘备 2:孙权 3:曹操>");
            int num = int.Parse(Console.ReadLine());
            Console.WriteLine("请输入您的姓名:");
            string name = Console.ReadLine();
            Console.WriteLine();

            if (num == 1)
            {
                Console.WriteLine(name + " VS " + " 刘备  对战！");
            }
            else if (num == 2)
            {
                Console.WriteLine(name + " VS " + " 孙权  对战！");
            }
            else
            {
                Console.WriteLine(name + " VS " + " 曹操 对战！");
            }

            Console.WriteLine("已选择好角色,确定开始游戏吗？（Y / N）");
            char num1 = char.Parse(Console.ReadLine());
            Console.WriteLine();

            if (num1 == 'Y')
            {
                for (int i = 0; i < 3; i++)
                {
                    Console.WriteLine();
                    Console.WriteLine("请出拳: 1，剪刀 2，石头 3，布 （请输入相应数字！）");
                    int num2 = int.Parse(Console.ReadLine());
                    Console.WriteLine();

                    int num3 = 0;
                    int num4 = 0;

                    if (num == 1)
                    {
                        if (num2 == 1 )
                        {
                            Console.WriteLine(name + " 出拳：" + "剪刀");
                            Console.WriteLine("刘备" + "出拳：" + "石头");
                            Console.WriteLine("笨蛋，" + name + "输了！");
                            num4++;
                        }
                        else if(num2 == 2)
                        {
                            Console.WriteLine(name + " 出拳：" + "石头");
                            Console.WriteLine("刘备"+ "出拳：" + "石头");
                            Console.WriteLine("平局");
                            
                        }
                        else
                        {
                            Console.WriteLine(name + " 出拳：" + "布");
                            Console.WriteLine("刘备" + "出拳：" + "石头");
                            Console.WriteLine("哈哈哈,你赢了");
                            num3++;
                        }
                        

                    }
                    else if (num == 2)
                    {
                        if (num2 == 1)
                        {
                            Console.WriteLine(name + " 出拳：" + "剪刀");
                            Console.WriteLine("孙权" + "出拳：" + "石头");
                            Console.WriteLine("真衰，嘿嘿，等着瞧！");
                            num4++;
                        }
                        if (num2 == 2)
                        {
                            Console.WriteLine(name + " 出拳：" + "石头");
                            Console.WriteLine("孙权" + "出拳：" + "石头");
                            Console.WriteLine("平局");
                        }
                        else
                        {
                            Console.WriteLine(name + " 出拳：" + "布");
                            Console.WriteLine("孙权" + "出拳：" + "石头");
                            Console.WriteLine("哈哈哈,你赢了");
                            num3++;
                        }


                    }
                    else
                    {
                        if (num2 == 1)
                        {
                            Console.WriteLine(name + " 出拳：" + "剪刀");
                            Console.WriteLine("曹操" + "出拳：" + "石头");
                            Console.WriteLine("哈哈哈,真衰,你输了");
                            num4++;
                        }
                        if (num2 == 2)
                        {
                            Console.WriteLine(name + " 出拳：" + "石头");
                            Console.WriteLine("曹操" + "出拳：" + "石头");
                            Console.WriteLine("平局");

                        }
                        else
                        {
                            Console.WriteLine(name + " 出拳：" + "布");
                            Console.WriteLine("曹操" + "出拳：" + "石头");
                            Console.WriteLine("哈哈哈,你赢了!");
                            num3++;
                        }

                    }
                    if (i == 2)
                    {
                        if (num == 1)
                        {
                            Console.WriteLine();
                            Console.WriteLine("******************************");
                            Console.WriteLine();
                            Console.WriteLine(name + "VS" + "刘备");
                            Console.WriteLine("对战次数：3");
                            Console.WriteLine();
                            Console.WriteLine("姓名     得分");
                            Console.WriteLine("刘备"+ "      " + num4);
                            Console.WriteLine(name + "      " + num3);
                            if (num3 > num4)
                            {
                                Console.WriteLine("恭喜" + name + "赢了!");
                            }
                            else if(num3 < num4)
                            {
                                Console.WriteLine("恭喜" + "刘备"+ "赢了!");
                            }
                            else
                            {
                                Console.WriteLine("哈哈哈,没想到吧,平局,嘿嘿!");
                            }

                        }
                        else if(num == 2)
                        {
                            Console.WriteLine();
                            Console.WriteLine("******************************");
                            Console.WriteLine();
                            Console.WriteLine(name + "VS" + "孙权");
                            Console.WriteLine("对战次数：3");
                            Console.WriteLine();
                            Console.WriteLine("姓名   得分");
                            Console.WriteLine("孙权" + "   " + num4);
                            Console.WriteLine(name+ "   " + num3);
                            if (num3 > num4)
                            {
                                Console.WriteLine("恭喜" + name + "赢了!");
                            }
                            else if(num3 < num4)
                            {
                                Console.WriteLine("恭喜" + "孙权" + "赢了!");
                            }
                            else
                            {
                                Console.WriteLine("哈哈哈,没有想到吧,平局,嘿嘿.");
                            }

                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("******************************");
                            Console.WriteLine();
                            Console.WriteLine(name + "VS" + "曹操");
                            Console.WriteLine("对战次数：3");
                            Console.WriteLine();
                            Console.WriteLine("姓名   得分");
                            Console.WriteLine("曹操"+ "   " + num4);
                            Console.WriteLine(name + "   " + num3);
                            if (num3 > num4)
                            {
                                Console.WriteLine("恭喜" + name + "赢了!");
                            }
                            else if (num3 < num4)
                            {
                                Console.WriteLine("恭喜" + "曹操" + "赢了!");
                            }
                            else
                            {
                                Console.WriteLine("哈哈哈,没有想到吧,平局,嘿嘿.");
                            }
                            

                        }

                    }
                }

            }
            else
            {
                Console.WriteLine("系统退出!!!");
            }

        }
    }
}
